/*
 *  DbExchangeTableEntryList.cpp
 *  StrategyInspector
 *
 *  Created by jiro on 12/08/08.
 *  Copyright 2012 jiro music. All rights reserved.
 *
 */

#include "DbExchangeTableEntryList.h"


DbExchangeTableEntryList::DbExchangeTableEntryList()
{
}

DbExchangeTableEntryList::DbExchangeTableEntryList( const std::vector< PGresult* >& results )
{
	for ( int i = 0, count = results.size(); i < count; i++ )
	{
		PGresult* result = results[ i ];
		int row = PQntuples( result );
		int column = PQnfields( result );
		this->resize( column );
		for ( int i = 0; i < row; i++ ) 
		{
			std::vector< const char* > values;
			for ( int j = 0; j < column; j++ )
			{
				values[ i ] = PQgetvalue( result, i, j );
			}
			DbExchangeTableEntry e( values );
			this->at( i ) = e;
		}
	}
}
